#!/bin/bash

if [ $CUBESYSPATH == "" ]
then
    echo "can't find CUBESYSPATH"
    exit
fi

echo "CUBESYSPATH is ${CUBESYSPATH}"

cd instance/tpm2_netlink_emulator
ln -s $CUBESYSPATH/main/main_proc
cd -
cd instance/tpm2_tcp_emulator
ln -s $CUBESYSPATH/main/main_proc
cd -
cd instance/tpm2_utils
ln -s $CUBESYSPATH/main/main_proc
cd -

cd locallib
make clean
make
cd -

cd src
make clean
make
cd -

cd init_module/tpm2_init
make clean
make
cd -
